package com.study.hot.jetpack.room.db

import androidx.room.*

/**
 * <pre>
 *     author : slx
 *     time   : 2021/02/25
 *     desc   :
 * </pre>
 */
// indices指定索引
@Entity(tableName = "t_user", indices = [Index("user_name")])
data class User(
        @PrimaryKey(autoGenerate = true) var userId: Long? = 0,
        @ColumnInfo(name = "user_name") var userName: String,
        @ColumnInfo(defaultValue = "china") var address: String,
        var des: String,
        @Embedded var money: Money, // 引用其他类，其他类的字段会在该类中

) {
  /*  @PrimaryKey(autoGenerate = true)
    var userId: Long = 0L*/

    @Ignore
    var sex: Boolean = false
}

data class Money(var total: Int, var desc: String)